#ifndef __GlGame_h__
#define __GlGame_h__

#include <d3d11.h>
#include "GlGameInterface.h"
#include "GlMain.h"
#include "GlWindowListener.h"

namespace GraphicLibrary
{
	class Window;

	class GlExport Game
		: public GameInterface
		, public WindowListener
	{
		public:
			Game();
			~Game();
			virtual void run(GameListener *game);

			virtual void afterWindowClosed(const MyDistributor *caller);
			virtual void afterMouseDown(const MyDistributor *caller, const ButtonId button, const float x, const float y);
			virtual void afterMouseUp(const MyDistributor *caller, const ButtonId button, const float x, const float y);
			virtual void afterMouseMove(const MyDistributor *caller, const float x, const float y);
			virtual void afterKeyDown(const MyDistributor *caller, const unsigned int key);
			virtual void afterKeyUp(const MyDistributor *caller, const unsigned int key);
		private:
			Window*					mWindow;
			bool					mExit;
			GameListener*			mListener;

			ID3D11Device*			mDevice;
			D3D_FEATURE_LEVEL		mFeatureLvl;
			ID3D11DeviceContext*	mImmediateContext;
			IDXGISwapChain*			mSwapChain;
			ID3D11RenderTargetView*	mRenderTarget;
			ID3D11BlendState*		mBlendState;

			void init();
			void destroy();
	};
}

#endif // __GlGame_h__
